package com.bleeth.flow.web.model;

import cn.hutool.core.date.DateUtil;
import lombok.Data;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.fun.DataProxy;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.Search;

import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author ：Bleeth
 * @date ：2022-05-16
 * @description：兴业数据管理模型
 */

@Erupt(name = "项目词典管理",
        dataProxy = FlowDictModel.class
)
@Entity
@Table(name = "flow_dict")
@Data
public class FlowDictModel extends FlowBaseModel implements DataProxy<FlowDictModel> {

    @EruptField(
            views = @View(title = "项目名称"),
            edit = @Edit(title = "项目名称",search = @Search(vague = true))
    )
    private String projectName;


    @EruptField(
            views = @View(title = "项目标识", sortable = true),
            edit = @Edit(title = "项目标识",search = @Search(vague = true))
    )
    private String projectUid;


    @EruptField(
            views = @View(title = "上次更新时间")
    )
    private String updateTime;


    @Override
    public void beforeAdd(FlowDictModel model) {
        model.setUpdateTime(DateUtil.date().toString());
    }

    @Override
    public void beforeUpdate(FlowDictModel model) {
        model.setUpdateTime(DateUtil.date().toString());
    }

}
